<?php
/***
 * 描述：商品变更历史记录
 * @category		Admin		
 * @package			Action			
 * @subpackage			
 * @author			wanght <whtaok@gmail.com>
 * @since			2013-4-6
 * @version			$Id: ProductLogManageAction.class.php 3 2013-10-14 02:49:41Z whtaok@gmail.com $
 */
class ProductLogManageAction extends AdminAction {
	
	/**
	 *
	 * @access		protected
	 * @author		wanght<whtaok@gmail.com>
	 * @since		2013-3-3
	 */
	protected  function _initialize() {
		parent::_initialize();
		$this->usingModel="ProductLog";
	}
	
	/**
	 *商品变更历史记录查询页面
	 * @access		public
	 * @author		wanght<whtaok@gmail.com>
	 * @since		2013-3-3
	 */
	public function indexAct() {
		//如果按条形码查询
		$barcode = I('barcode');
		if($barcode){
			$mod = new ProductLibModel();
			$product = $mod->field('id')->findByBarcode($barcode);
			$prod_id = $product['id'];
		}else{
			$prod_id = I('prod_id');
		}
		$search = array(
			'shop_id'=> session(SES_SHOP_ID),
			'prod_id'=> $prod_id,
			'type'=> I('type'),
			'start_date'=> I('start_date'),
			'end_date'=> I('end_date'),
		);
		$mod = new ProductLogModel();
		list($list,$page)=$mod->findListPage($search);
		$this->assign('list',$list);
		$this->assign('page',$page);
		$this->assign('search',$search);
		$this->display('index');
	}
	
	/**
	 * 指定商品变更历史记录
	 * @access		public
	 * @author		wanght<whtaok@gmail.com>
	 * @since		2013-3-3
	 */
	public function showListAct(){
		$search = array(
				'shop_id'=> session(SES_SHOP_ID),
				'prod_id'=> I('prod_id'),
				'type'=> I('type')
		);
		$mod = new ProductLogModel();
		list($list,$page)=$mod->findListPage($search);
		$this->assign('list',$list);
		$this->assign('search',$search);
		exit($this->fetch('list'));
	}
}

?>